home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / nihcl-30.lha / nihcl-3.0 / ex / ex8-5.c < prev    next >
C/C++ Source or Header  |  1990-05-15  |  609b  |  25 lines

  1. // ex8-5.c -- Modifying a container during iteration
  2.  
  3. // $Header: /afs/alw.nih.gov/unix/sun4_40c/usr/local/src/nihcl-3.0/share/ex/RCS/ex8-5.c,v 3.0 90/05/15 22:46:20 kgorlen Rel $
  4.  
  5. #include "OrderedCltn.h"
  6. #include "Iterator.h"
  7. #include "String.h"
  8.  
  9. main()
  10. {
  11.     OrderedCltn symbols;
  12.     symbols.add(*new String("A"));
  13.     symbols.add(*new String("C"));
  14.     symbols.add(*new String("G"));
  15.     symbols.add(*new String("T"));
  16.  
  17.     OrderedCltn temp = symbols;
  18.     Iterator it(temp);
  19.     while (it++)
  20.         if (it()->compare(String("G")) < 0)
  21.             symbols.removeId(*it());
  22.  
  23.     cout << symbols << endl;
  24. }
  25.